export default () => {
    let myChart2 = echarts.init(document.getElementById('barChart2'));
        const option = {
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    crossStyle: {
                        color: '#999'
                    }
                }
            },
            toolbox: {
                feature: {
                    dataView: {show: true, readOnly: false},
                    magicType: {show: true, type: ['line', 'bar']},
                    restore: {show: true},
                    saveAsImage: {show: true}
                }
            },
            legend: {
                data:['库存量','分配量','库龄']
            },
            grid:{
                bottom: '30px',
            },
            xAxis: [
                {
                    type: 'category',
                    data: ['CP001','CP002','CP003','CP004','CP005'],
                    axisPointer: {
                        type: 'shadow'
                    }
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    name: '库存量',
                    min: 0,
                    max: 1400,
                    interval: 200,
                    axisLabel: {
                        formatter: '{value}'
                    }
                },
                {
                    type: 'value',
                    name: '分配量',
                    min: 0,
                    max: 1400,
                    interval: 200,
                    axisLabel: {
                        formatter: '{value}'
                    }
                }
            ],
            series: [
                {
                    name:'库存量',
                    type:'bar',
                    itemStyle: {
                        normal: {
                            color: 'rgb(53,167,255)'
                        }
                    },
                    data:[1000,600,800,1200,1000]
                },
                {
                    name:'分配量',
                    type:'bar',
                    itemStyle: {
                        normal: {
                            color: 'rgb(255,162,0)'
                        }
                    },
                    data:[800,500,600,400,600]
                },
                {
                    name:'库龄',
                    type:'line',
                    itemStyle: {
                        normal: {
                            color: 'rgb(21,159,136)'
                        }
                    },
                    yAxisIndex: 1,
                    data:[1200,1000,1400,1200,1000]
                }
            ]
        };

        myChart2.setOption(option);        
        window.onresize = myChart2.resize;

}